const express=require('express');
const db = require('../db/index');
const Entry = require('../models/entry')
const router= new express.Router();
router.post('/entry-exam',async(req,res)=>{
    console.log(req.body);
    await db;
    try{
        await Entry.create(req.body);

        
        res.send('学生成绩提交成功！！');
    }catch(e){
        console.log(e);
        res.send('请重新输入！！')
    }
})

router.post('/mid-exam',async(req,res)=>{
    console.log(req.body);
    await db;
    try{
        await Entry.create(req.body);

        
        res.send('学生成绩提交成功！！');
    }catch(e){
        console.log(e);
        res.send('请重新输入！！')
    }
})

router.post('/end-exam',async(req,res)=>{
    console.log(req.body);
    await db;
    try{
        await Entry.create(req.body);

        
        res.send('学生成绩提交成功！！');
    }catch(e){
        console.log(e);
        res.send('请重新输入！！')
    }
})


module.exports = router;
